{% extends "account/base.html" %}

{% load i18n %}
{% load account %}

{% block head_title %}{% trans "Sign In" %}{% endblock %}

{% block body_class %}login-page{% endblock %}

{% block content %}

<h1>{% trans "Sign In" %}</h1>

{% if is_from_cas_login %}
<p>
  {% blocktrans %}
    In order to view this documentation, you must log in first.
  {% endblocktrans %}
</p>
{% endif %}

{% if allowed_providers %}
  {# If allowed providers is given, don't show the username/password form #}
  <div class="clearfix">
    <ul class="socialaccount_providers">
      {% include "socialaccount/snippets/provider_list.html" with process="login" next=request.GET.next verbiage="Sign in with" %}
    </ul>
  </div>

  {% if project_password_url %}
  <h3>{% trans 'Or' %}</h3>
  <p>
      {% blocktrans trimmed with project_password_url=project_password_url %}
      Do you have a password to access this documentation?
      <a href="{{ project_password_url }}">Access here</a>.
      {% endblocktrans %}
  </p>
  {% endif %}

{% else %}

  <p><small>{% blocktrans trimmed %}If you have not created an account yet, then please
  <a href="{{ signup_url }}">sign up</a> first.{% endblocktrans %}</small></p>

  <form class="login" method="POST" action="{% url "account_login" %}">
    {% csrf_token %}
    {{ form.as_p }}
    {% if redirect_field_value %}
    <input type="hidden" name="{{ redirect_field_name }}" value="{{ redirect_field_value }}" />
    {% endif %}
    <button class="primaryAction" type="submit">{% trans "Sign In" %}</button>

    {% url 'account_reset_password' as password_reset_url %}
    <p>
      <small>{% blocktrans trimmed %}If you forgot your password, <a href="{{ password_reset_url }}">reset it.</a>{% endblocktrans %}</small>
    </p>
  </form>

  {% if project_password_url %}
  <h3>{% trans 'Or' %}</h3>
  <p>
      {% blocktrans trimmed with project_password_url=project_password_url %}
      Do you have a password to access this documentation?
      <a href="{{ project_password_url }}">Access here</a>.
      {% endblocktrans %}
  </p>
  {% endif %}

  <h3>{% trans 'Or' %}</h3>

  <div class="clearfix">
    <ul class="socialaccount_providers">
      {% include "socialaccount/snippets/provider_list.html" with process="login" next=request.GET.next verbiage="Sign in with" %}
    </ul>
  </div>
{% endif %}

{% endblock content %}
